import {User} from "@/store/login_data.ts";
import request from "@/utils/request.ts";


export const getUserinfo = async (): Promise<User> => {
    try {
        let res: any =await request({
            url: "/api/user/userinfo",
            method: "GET",
        });
        if (res.code == 200) {
            return res.data as User;
        } else {
            throw new Error('获取用户信息失败' + res.message)
        }
    } catch (e) {
        console.log(e.message)
    }
}